﻿using FilmBlowingMachine.Model;
using FilmBlowingMachine.View;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;

namespace FilmBlowingMachine.ViewModel
{
    class LoginViewModel : ViewModelBase
    {

        public LoginViewModel()
        {
            Login = new LoginModel() { UserName = "admin", Password = "admin" };
            ExitCommand = new RelayCommand(ExitCmd);
            LoginCommand = new RelayCommand(LoginCmd);
        }

        #region Property

        private LoginModel login;
        public LoginModel Login
        {
            get { return login; }
            set { login = value; RaisePropertyChanged(); }
        }

        #endregion

        #region Command

        public RelayCommand ExitCommand { get; set; }
        public RelayCommand LoginCommand { get; set; }

        private void ExitCmd()
        {
            Messenger.Default.Send(true, "ExitLogin");
        }

        private void LoginCmd()
        {
            Messenger.Default.Send(true, "Login");
        }
        #endregion
    }
}
